<jsp:include page="header.jsp">
			<jsp:param value="item2" name="item"/>
</jsp:include> 
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<section class="content">
	<section class="widget">
		<header>
			<span class="icon">&#128196;</span>
			<hgroup>
				<h1>点数兑换管理</h1>
				<!--<h2>兑换物品列表</h2>
			--></hgroup>
		</header>
		<div class="content">
		<div class="tabs" id="tabs">
		    <ul>
		        <li><a href="ruleManage">兑换规则</a></li>
		        <li class="on">物品</li>
		       <li ><a href="exchangeRecordManage">修改状态</a></li>
		    </ul>
		    	
				<div class="show">
					<input type="button" id="addItem" class="button white" value="增加"/><br/><br/>
					<s:if test="giftList!=null && giftList.{?#this.giftName != '现金'}.size != 0">
					<!--<s:property value="giftList.size"/>
						--><table id="myTable">
					    	<tr>
					    		<!--<th>物品编号</th>
					    		--><th>物品名</th>
					    		<th>价值</th>
					    		<th>数量</th>	
					    		<th>描述</th>
					    		<th>操作</th> 	 				
					    	</tr>
					    	<s:iterator value="giftList.{?#this.giftName != '现金'}" id="row" status="state">
					    		<s:form action="updateGift" method="post">
							    <tr>
							    	<!--<td><input type="text" name="gift.giftId" readonly="readonly"  value=<s:property value="#row.giftId"/> /></td>
							    	--><td><input type="text" name="gift.giftName"   value=<s:property value="#row.giftName" />
							    			required="required" maxlength="45" /></td>
							    	<td><input type="text" name="gift.giftValue"   value=<s:property value="#row.giftValue"/>
							    		required="required"  maxlength="11"  /></td>
							    	<td><input type="text" name="gift.number"  value=<s:property value="#row.number"/>
							    		required="required" "  />
							    		<!--<input type='text' name="gift.number" onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9]/,'');}).call(this)" onblur="this.v();" 
							    			required="required"  maxlength="11"  />
							    		--></td>
							    	<td><input type="text" name="gift.description"    value="<s:property value='#row.description'/>" 
							    		maxlength="225"/></td>
							    	<td>
							    		<input type="hidden" name="gift.giftId" value=<s:property value="#row.giftId"/> />
							    		<input type="submit" formaction="deleteGift"  class="button white" value="删除">
				    					<input type="submit"  class="button white" value="修改"/>
							    	</td>   	
							    </tr>
							    </s:form>
						    </s:iterator>
					    </table>
						</s:if>
						<s:else>
							<p>尚不存在兑换物品！！</p><br/>	
						</s:else>
					
			</div>
		</div>
						<div id="popup" class="hide">
					    	<form id="reg-form" action="addGift" method="post">
	
						        <table id="myTable">
									<!--<tr>
										<td>物品编号</td>
										<td><input name="gift.giftId" type="text" id="giftId">
										</td>
									</tr>
									--><tr>
										<td>物品名</td>
										<td><input name="gift.giftName" type="text" id="giftName"></td>
									</tr>
									<tr>
										<td>价值</td>
										<td><input name="gift.giftValue" type="text" id="giftValue">
										</td>
									</tr>
									<tr>
										<td>数量</td>
										<td><input name="gift.number" type="text" id="number"></td>
									</tr>
									<tr>
										<td>描述</td>
										<td><input name="gift.description" type="text" id="description">
										</td>
									</tr>
									
								</table>
	
								<div class="buttons">
									<input value="完成" type="submit" class="button white">
									<input value="重置" type="reset" class="button white">
						        </div>
						    </form>
						</div>
	</section>
	<script type="text/javascript">
		
		var addItem = document.getElementById("addItem");
		
		//添加信息
		addItem.onclick=function(){
	    	layer.open({
		        type: 1,
		        skin:'layui-layer-lan',
		        area: ['360px', '450px'],
		        shadeClose: true, //点击遮罩关闭
		        content:$('#popup')
			});
		}
	   
		var message="<%=request.getAttribute("message")%>";
		if(message!="null"){
			alert(message);
		}
	</script>
<%@ include file="footer.jsp" %>